package edu.zac.config;

import edu.zac.pojo.Emp;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * @Title
 * @Author Peihan.Zhang
 * @Email zhangpeihan@sjgtw.com
 * @Date 2021/10/19 19:14
 * @Versions 1.0
 */

@Configuration
@ComponentScan("edu.zac")
@PropertySource(value ="classpath:/Emp.properties",encoding = "utf-8")
public class SpringConfig {
    @Value("${Emp.id}")
    private Integer id;
    @Value("${Emp.name}")
    private String  name;
    @Value("${Emp.salary}")
    private Double salary;
    @Value("${Emp.job}")
    private  String job;

@Bean
    public Emp emp(){
    return  new Emp(this.id, this.name, this.salary, this.job);

}

}
